# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-j2cli
pkgname=('python2-j2cli' 'python-j2cli')
_pkgname=j2cli
pkgver=0.3.10
pkgrel=8
pkgdesc='Command-line interface to Jinja2 for templating in shell scripts.'
url='https://github.com/kolypto/j2cli'
license=('BSD')
arch=('any')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('9750a89135c227c8daf0037c8f6ca913a72229f5a84b8185c033700286bdf8f905c7cf612be984c969f0e5940c898e39cd9eaef60b808310d5aa062cadab82a4')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"
}

package_python2-j2cli() {
  depends=('python2' 'python2-jinja')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/j2" "$pkgdir/usr/bin/j2-2"
}

package_python-j2cli() {
  depends=('python' 'python-jinja')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

